<style>
.width {
	min-width: 119px;
}
</style>
<script
	src="<?= base_url(); ?>third_party/ckeditor/ckeditor.js"></script>

<?php if($mode== "ADD"){?>
<section class="wrapper">
	<!-- page start-->
	<section class="panel">
		<header class="panel-heading"> HELP AND TIPS MANAGEMENT </header>
		<div class="panel-body">
		
			<form class="form-horizontal" role="form" name="news" method="POST"
				action="<?= base_url(); ?>secure/helptips/submit">
				<?php
				$this->session->flashdata('message'); {
					$msg = $this->session->flashdata('message');
					echo '<font color="red">' . $msg . '</font>';
				}
				?>
				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Desciption</label>
					<div class="col-lg-8">
						<span class="text text-danger">
						<?php echo form_error('description');?></span>
						<span class="text text-warning">
						(Maximum 250 Characters)
						</span>
						<textarea class="form-control ckeditor" id="description" name="description" rows="3"></textarea>
<script type="text/javascript">
                            CKEDITOR.replace( 'description',
                            {
                                skin : 'v2',
                                enterMode : CKEDITOR.ENTER_BR,
                                toolbar :
                                    [
                                    [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                    [ 'UIColor' ]
                                ]

                            });
                        </script>
					</div>
				</div>

				<div class="form-group">
					<div class="col-lg-offset-2 col-lg-8">
						<input type="submit" class="btn btn-info pull-right" value="Add" name="helptips" <?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');"  >
					</div>
				</div>


			</form>
		</div>
		<!-- End of Body Panel -->
	</section>
	<section class="panel">
					<header class="panel-heading"> HELP AND TIPS MANAGEMENT   </header>
					<div class="panel-body">
					<div class="input-group col-lg-5 pull-right">
                                          <form name="action" method="POST"
							action="<?=base_url(); ?>secure/helptips">
							
							<div class="col-lg-offset-2 col-lg-7">
							</div>
							 <select class="form-control" name="filter" style="width:100px"
								onchange="this.form.submit()">
								<option value="">-Select-</option>
								<option value="inactive">Inactive</option>
								<option value="active">Active</option>
							
							</select>
						</form>
                                          
                                          
                                             
                                              </div>
						<table class="table table-striped table-advance table-hover">
							<thead>
								<tr>
									<th><i class="icon-bullhorn"></i> Posted On</th>
									<th class="hidden-phone "><i class="icon-bookmark"></i>
										Description</th>
									<th><i class="icon-bookmark"></i>
										Status</th>
									<th><i class="icon-edit"></i> Action</th>
								</tr>
							</thead>
							<tbody>
							<?php if($help['tips']){?>
							<?php foreach($help['tips'] as $helptips):?>
								<tr>
									<th><?= $helptips->posted_on;?></th>
									<td class="hidden-phone">
									<?= substr($helptips->description,0,80);?>
									</td>
									<?php if($helptips->status ==51){?>
									<td><button class="btn btn-success btn-xs">
											<i class=" icon-ok"> Active</i>
										</button></td>
									<?php }else{?>
									<td><button class="btn btn-danger btn-xs">
											<i class=" icon-remove"> Inactive</i>
										</button></td>
									<?php }?>
									<td>
									
									
										<div class="dropdown">
								<a href="javascript:;"
									class="dropdown-toggle btn btn-danger btn-xs"
									data-toggle="dropdown">Menu <b class="caret"></b>
								</a>
								<ul class="dropdown-menu width">
									<li>
									<?php if($helptips->status ==1){?>
									<a href="<?= base_url(); ?>secure/helptips/change_tips_status/<?= $helptips->status;?>/<?= $helptips->id; ?>" <?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');" 
									><button
												class="btn btn-primary btn-xs">
												<i class="icon-thumbs-up"></i>
											</button> Active</a>
											
											</li>
											
									<li>
									<?php }else{?>
									<a href="<?= base_url(); ?>secure/helptips/change_tips_status/<?= $helptips->status;?>/<?= $helptips->id; ?>" <?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');"
									><button
												class="btn btn-danger btn-xs">
												<i class="icon-thumbs-down"></i>
											</button> Inactive</a>
											<?php }?>
											
											</li>
							
									<li><a href="<?= base_url(); ?>secure/helptips/edit/<?= $helptips->id;?>"
									<?php if($this->config->item('mode')=='DEMO'){?>
										onclick="alert ('Sorry! Demo mode '); return false;"
									<?} else?> onclick="return confirm('Are you sure ?');"><button
												class="btn btn-primary btn-xs">
												<i class="icon-pencil"></i>
											</button> Edit</a></li>
								<li><a href="<?= base_url(); ?>secure/helptips/delete/<?= $helptips->id;?>" <?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');"
									><button
												class="btn btn-danger btn-xs">
												<i class="icon-trash"></i>
											</button> Delete</a></li>
							
							</div>
									</td>
								</tr>
								<?php endforeach;}else{?>
								<?php echo "No data found";}?>
								
							</tbody>
						</table>
					</div>
					<!-- End of Body Panel -->
				</section>
	</section>
<?php }?>	
<?php if($mode== "EDIT"){?>	
	<section class="wrapper">
	<!-- page start-->
	<section class="panel">
		<header class="panel-heading"> HELP AND TIPS MANAGEMENT 
		<span class="pull-right"><a href="<?= base_url();?>secure/helptips"
				type="button" class="btn btn-success btn-sm">Back</a> </span>
		</header>
		
		
		<div class="panel-body">
		
			<form class="form-horizontal" role="form" name="news" method="POST"
				action="<?= base_url(); ?>secure/helptips/update">
				<?php
				$this->session->flashdata('message'); {
					$msg = $this->session->flashdata('message');
					echo '<font color="red">' . $msg . '</font>';
				}
				?>
				<div class="form-group">
					<label for="input" class="col-lg-2 control-label">Desciption</label>
					<div class="col-lg-8">
						<span class="text text-danger">
						<?php echo form_error('description');?></span>
						<span class="text text-warning">
						(Maximum 250 Characters)
						</span>
						<textarea class="form-control ckeditor" id="description" name="description" rows="3">
						<?= $tips['info']->description;?>
						</textarea>
<script type="text/javascript">
                            CKEDITOR.replace( 'description',
                            {
                                skin : 'v2',
                                enterMode : CKEDITOR.ENTER_BR,
                                toolbar :
                                    [
                                    [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                    [ 'UIColor' ]
                                ]

                            });
                        </script>
					</div>
				</div>

				<div class="form-group">
					<div class="col-lg-offset-2 col-lg-8">
					<input type="hidden" name="id" value="<?= $tips['info']->id;?>">
						<input type="submit" class="btn btn-info pull-right" value="Update" name="helptips" <?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');"  >
					</div>
				</div>


			</form>
		</div>
		<!-- End of Body Panel -->
	</section>
	<?php }?>
	
	
	<!-- page end-->
</section>
